package com.anywhere.freightman.system.dao;

import com.anywhere.freightman.common.BaseMapper;
import com.anywhere.freightman.system.model.AccessToken;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

@Mapper
@Repository
public interface AccessTokenDao extends BaseMapper<AccessToken> {
    @Select("select * from access_token where user_id=#{userId} and status='ENABLE'")
    AccessToken getByUserId(@Param("userId") long userId);

    @Select("select * from access_token where user_id=#{userId}")
    List<AccessToken> getListByUserId(long userId);

    @Select("select * from access_token where token=#{token} and status='ENABLE'")
    AccessToken getByToken(String token);

}
